/*
* 获取uuid
* */
const S4 = () => (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
export const uuid = (len: number = 6) => Array.from({ length: len }).map(() => S4()).join('-');

export const getFileType = (filePath: string) => {
  const startIndex = filePath.lastIndexOf('.');
  return startIndex !== -1 ? filePath.substring(startIndex + 1, filePath.length).toLowerCase() : '';
}

/*
* 是否为原生正则
* */
export const isReg = (value: string | RegExp) => {
  return Object.prototype.toString.call(value) === '[object RegExp]';
}
